﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>


  <title>Goto</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <link href="../css/commands.css" rel="stylesheet" type="text/css">

  <link href="../css/print.css" rel="stylesheet" type="text/css" media="print">
</head>


<body>


<h1>Goto</h1>


<p>跳转到指定的标签并继续执行。</p>


<p class="CommandSyntax">Goto, Label</p>

<h3>参数 </h3>

<table border="1" bordercolor="#c0c0c0" cellpadding="3" cellspacing="0" width="100%">

  <tbody>
    <tr>
 
    <td width="15%">Label</td>

    <td width="85%">要跳转到的标签名称。</td>

  </tr>

  </tbody>
</table>


<h3>注意</h3>

<p>当使用一个动态标签比如 %MyLabel%&nbsp;时，如果标签不存在，将会显示一个错误对话框。要避免这种情况，可事先调用 <a href="../Functions.htm#IsLabel">IsLabel()</a>。例如：</p>

<pre>if IsLabel(VarContainingLabelName)<br>    Goto %VarContainingLabelName%</pre>

<p>不鼓励使用 Goto，因为它通常使脚本不太易读并且难以维护。可以考虑使用 <a href="Else.htm">Else</a>, <a href="Block.htm">Blocks</a>, <a href="Break.htm">Break</a> 和 <a href="Continue.htm">Continue</a> 来代替 Goto。</p>

<h3>相关命令</h3>

<p><a href="Gosub.htm">Gosub</a>, <a href="Return.htm">Return</a>, <a href="../Functions.htm#IsLabel">IsLabel()</a>, <a href="Else.htm">Else</a>, <a href="Block.htm">Blocks</a>, <a href="Break.htm">Break</a>, <a href="Continue.htm">Continue</a> </p>

<h3>示例</h3>

<pre class="NoIndent">Goto, MyLabel<br>...<br>MyLabel:<br>Sleep, 100<br>...</pre>



</body>
</html>
